package com.da.springcloud.controller;

import com.da.springcloud.entities.CommonResult;
import com.da.springcloud.service.AccountService;
import com.da.springcloud.util.ResultUtil;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

import java.math.BigDecimal;

/**
 * @author zzyy
 * @date 2020/3/8 14:21
 **/
@RestController
public class AccountController {
    @Resource
    private AccountService accountService;

    @PostMapping(value = "account/decrease")
    public CommonResult<Void> decrease(@RequestParam("userId") Long userId, @RequestParam("money") BigDecimal money) {
        accountService.decrease(userId, money);
        return ResultUtil.success("扣减账户余额成功");
    }
}
